<?php

namespace App\Department\Controllers;

use App\Http\Controllers\Controller;
use App\Repositories\PatentApplyRepository;
use App\Services\PatentApplyService;
use Encore\Admin\Grid;
use Encore\Admin\Layout\Content;

class PatentController extends Controller
{
    protected $title = '已授权专利';
    public $repository;
    public $service;

    public function __construct(PatentApplyRepository $repository, PatentApplyService $service)
    {
        $this->repository = $repository;
        $this->service = $service;
    }

    public function index(Content $content)
    {
        return $content
            ->title($this->title)
            ->body($this->grid());
    }

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = $this->repository->deptGrid();
        $grid = $this->service->gridColumns($grid, 2, 1);
        $grid->disableActions();
        return $grid;
    }
}
